package com.haoting.blogservice.controller.front;

import com.haoting.blogservice.entity.vo.BlogIndexVo;
import com.haoting.blogservice.service.BlogService;
import com.haoting.commonutils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/blogservice/indexfront")
//@CrossOrigin
public class IndexFrontController {

    @Autowired
    private BlogService blogService;

    @GetMapping("index")
    public CommonResult index(){
        List<BlogIndexVo> blogIndexVo = blogService.getBlogIndexVo();
        return CommonResult.ok().data("list",blogIndexVo);
    }

    @GetMapping("hot")
    public CommonResult hot(){
        List<BlogIndexVo> blogIndexVo = blogService.gethotblogVo();
        return CommonResult.ok().data("hot",blogIndexVo);
    }
}
